
with open('data/problem022.txt') as file:
    names = sorted([name.strip('\"') for name in file.read().split(',')])

scores = 0
for index, name in enumerate(names):
    scores += (index + 1) * sum([ord(c) - ord('A') + 1 for c in name])
print scores
